package org.swings.builder;

import java.io.File;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import org.apache.log4j.Logger;
import org.swings.builder.components.Application;

/**
 * <p>
 * <b>Overview:</b>
 * <p>
 * 
 * 
 * <pre>
 * Creation date: Feb 16, 2015
 * @author Amit Kshirsagar
 * @version 1.0
 * @since
 * 
 * <p><b>Modification History:</b><p>
 * 
 * 
 * </pre>
 */

public class JComponentBuilder {
	static Logger log = Logger.getLogger(JComponentBuilder.class.getName());

	public static Application application = null;

	public static void parseDom2Components(String applicationComponentXml) {
		if (application == null) {
			try {
				File file = new File(applicationComponentXml);
				JAXBContext jaxbContext = JAXBContext
						.newInstance(Application.class);

				Unmarshaller jaxbUnmarshaller = jaxbContext
						.createUnmarshaller();
				application = (Application) jaxbUnmarshaller.unmarshal(file);
			} catch (JAXBException e) {
				e.printStackTrace();
			}
		}

	}

}
